package org.activequant.data.retrieval.mock;

import org.activequant.core.domainmodel.InstrumentSpecification;
import org.activequant.core.domainmodel.data.Quote;
import org.activequant.core.types.TimeFrame;
import org.activequant.data.retrieval.IQuoteSubscriptionSource;
import org.activequant.data.retrieval.ISubscription;

/**
 * Mock source of quote subscriptions driven by a separate thread.
 * Use it for unit testing services that depend on subscription service.
 * Supports only one outstanding subscription.
 * <p>
 * To use, instantiate the mock subscription source, then hook it into the
 * application.
 * <br>
 * <br>
 * <b>History:</b><br>
 *  - [16.01.2008] Created (Erik Nijkamp)<br>
 *
 *  @author Erik Nijkamp
 */
public class MockThreadQuoteSubscriptionSource extends MockThreadSubscriptionSourceBase<Quote>
	implements IQuoteSubscriptionSource {

	public ISubscription<Quote> subscribe(InstrumentSpecification spec)
			throws Exception {
		return super.subscribe(spec, TimeFrame.TIMEFRAME_1_TICK);
	}
	
	@Override
	protected Quote newElement(InstrumentSpecification spec, TimeFrame timeFrame) {
		return new Quote(spec);
	}

}
